<template>
  <div v-if="orderDetail" style="position:relative;">
    <div class="ub bg_f2 ub-ver">
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w">
        <div class="ub wd_100 ub-pj pad_b05">
          <div class="ub">
            <div class="ub ticket ub-img1"></div>
            <div class="ub ub-ac mar_l1">订单号{{orderDetail.orderNo}}</div>
          </div>
          <div class="ub">
            <div class="ub ub-ac fc_otx">￥{{orderDetail.orderTotalSum + (orderDetail.orderPayHandle || 0)}}</div>
            <div class="ub ub-img1 mar_l1" :class="{'arrow_down':showOrder,'arrow_up':!showOrder}" @click="showOrder = !showOrder"></div>
          </div>
        </div>
        <div class="ub wd_100 border_line pad_t1" v-show="showOrder">
          <div class="ub ub-ver">
            <div class="ub ub-ac pad_b05">预订时间</div>
            <div class="ub ub-ac pad_b05">联系人</div>
            <div class="ub ub-ac pad_b05">联系电话</div>
          </div>
          <div class="ub ub-ver">
            <div class="ub pad_b05">
              <div class="ub ub-ac mar_l1 ">{{$utils.formatTime(orderDetail.orderCreateTime).first}}</div>
              <div class="ub ub-ac mar_l1">{{$utils.formatTime(orderDetail.orderCreateTime).second}}</div>
            </div>
            <div class="ub ub-ac mar_l1 pad_b05">{{orderDetail.userLinkMan}}</div>
            <div class="ub ub-ac mar_l1 pad_b05">{{orderDetail.userLinkPhone}}</div>
          </div>
        </div>
      </div>
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w mar_t1">
        <div class="ub wd_100 ub-pj pad_b05">
          <div class="ub">
            <div class="ub plane ub-img1"></div>
            <div class="ub ub-ac mar_l1">航班信息</div>
          </div>
          <div class="ub" v-show="orderType==2" @click="goTicket">
            <div class="ub ub-ac ">机票详情</div>
            <div class="ub arrow_right ub-img1 mar_l1"></div>
          </div>
        </div>
        <div class="ub wd_100 border_line pad_t1 ub-ver">
          <div class="ub">
            <div class="ub ub-ac fc_purple">{{orderDetail.orderGoFlightAirLine + orderDetail.orderGoFlightNum}}</div>
            <div class="ub ub-ac mar_l1 fc-8b">{{orderTimes.four.year + '年' +orderTimes.four.month + '月' + orderTimes.four.date + '日'}}</div>
            <div class="ub ub-ac mar_l1 fc-8b">{{orderTimes.third}}</div>
          </div>
          <div class="ub mar_t1">
            <div class="ub plane_dan ub-img"></div>
            <div class="ub ub-ver">
              <div class="ub">
                <div class="ub ub-ac">{{orderDetail.orderBeginCityDetails.split('_')[1]}}</div>
                <div class="ub ub-ac margin-l05" v-if="orderDetail">{{orderDetail.orderGoBeginTime.substring(0,5)}}</div>
              </div>
              <div class="ub pad_t05">
                <div class="ub ub-ac">{{orderDetail.orderEndCityDetails.split('_')[1]}}</div>
                <div class="ub ub-ac  margin-l05" v-if="orderDetail">{{orderDetail.orderGoEndTime.substring(0,5)}}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!--餐食预定-->
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w mar_t1" @click="ydClick" v-show="orderDetail.orderStatus==='已出票' && orderType == 1">
        <div class="ub ub-pj">
          <div class="ub ub-ac">您可能还需要以下增值服务</div>
          <div class="ub ub-img1 mar_l1 arrow_right"></div>
        </div>
        <div class="ub">
          <div class="ub ub-pc wd_50">
            <div class="ub ub-ver ub-ac mar_t05">
              <div class="ub ub-img detail_need_pack"></div>
              <div class="ub pad_t05 ub-pc">预定行李</div>
            </div>
          </div>
          <div class="ub ub-pc wd_50">
            <div class="ub ub-ver ub-ac mar_t05">
              <div class="ub ub-img detail_need_shipin"></div>
              <div class="ub pad_t05 ub-pc">预定餐食</div>
            </div>
          </div>
        </div>
      </div>
      <!--显示可以购买的乘客-->
      <div class="ub passengerMask ub-ac" v-show="passengerMask">
        <div class="ub passengerBox ub-ac">
          <div class="ub showPassenger ub-ver pad_1">
            <div class="ub canncelX" @click="passengerMask = false">X</div>
            <div class="ub ub-ac ub-pc">选择要购买增值服务的乘机人</div>
            <div class="ub ub-pj mar_t1" v-for="(item, index) in showObjArr" v-show="item.piType != '婴儿'" @click="buyFy(item.ticketNo, item.piName)">
              <div class="ub">
                <div class="ub">票号</div>
                <div class="ub margin-l05">{{item.ticketNo}}</div>
              </div>
              <div class="ub">{{item.piName}}</div>
            </div>
          </div>
        </div>
      </div>
      <!--乘机人信息-->
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w mar_t1" v-show="orderType == 1">
        <div class="ub wd_100 ub-pj pad_b05">
          <div class="ub">
            <div class="ub detail_passenger ub-img1"></div>
            <div class="ub ub-ac mar_l1">乘机人信息</div>
          </div>
        </div>
        <div class="ub wd_100 border_line pad_t1 ub-ver" v-show="showObjArr.length>0">
          <div class="ub ub-ver ub-pc mar_b1" v-for="(item, index) in showObjArr">
            <div class="ub wd_100 ub-pj pad_b05">
              <div class="ub">
                <div class="ub ub-ac">{{item.piName}}</div>
                <div class="ub ub-ac">
                  <div class="p_type">
                    {{item.piType}}
                  </div>
                </div>
              </div>
              <div class="ub">
                <!-- <div class="ub ub-ac">{{item.status}}</div> -->
                <div class="ub ub-img1 mar_l1" @click="item.ifshow = !item.ifshow" :class="{'arrow_down': item.ifshow,'arrow_up': !item.ifshow}"></div>
              </div>
            </div>
            <div class="ub wd_100 ub-pj pad_b05">
              <div class="ub">证件号</div>
              <div class="ub">{{item.piNumber}}</div>
            </div>
            <div class="ub wd_100 ub-pj pad_b05" v-if="item.ticketNo && (item.status === '已出票' || item.status === '已取消')">
              <div class="ub">票号</div>
              <div class="ub">{{item.ticketNo}}</div>
            </div>
            <div class="ub p_box ub-ver fz08" v-show="item.ifshow">
              <div class="ub wd_100 ub-pj pad_b1">
                <div class="ub">机票</div>
                <div class="ub">￥{{item.detailTicketPrice}}</div>
              </div>
              <div class="ub wd_100 ub-pj pad_b1">
                <div class="ub" v-show="!ishome.data">民航发展基金(CN)</div>
                <div class="ub" v-show="ishome.data">税费</div>
                <div class="ub">￥{{item.detailTicketTPrice}}</div>
              </div>
              <div class="ub wd_100 ub-pj pad_b1">
                <div class="ub">燃油附加费</div>
                <div class="ub">￥{{item.detailTicketFPrice}}</div>
              </div>
              <!-- <div class="ub wd_100 ub-pj pad_b1">
                <div class="ub">退改无忧</div>
                <div class="ub">￥0</div>
              </div> -->
              <div class="ub wd_100 ub-pe">
                <div class="ub fc_FF9D01">小计:￥{{item.detailTicketPrice + item.detailTicketTPrice + item.detailTicketFPrice}}</div>
              </div>
            </div>
          </div>

        </div>
      </div>
      <!--退款信息-->
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w mar_t1" v-if="hasTui">
        <div class="ub wd_100 ub-pj pad_b05">
          <div class="ub">
            <div class="ub order_tui ub-img1"></div>
            <div class="ub ub-ac mar_l1">退订机票信息</div>
          </div>
          <div class="ub ub-img1 mar_l1" :class="{'arrow_down':orderTui,'arrow_up':!orderTui}" @click="orderTui = !orderTui"></div>
        </div>
        <div class="ub wd_100 border_line pad_t1 ub-ver" v-show="orderTui" v-for="(item, key) in orderTuiObj">
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">申请单号</div>
            <div class="ub ub-ac">{{key}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">申请日期</div>
            <div class="ub ub-ac">{{item.refundTicketGoTime}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">退订状态</div>
            <div class="ub ub-ac">{{item.refundTicketGoState}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">实扣金额</div>
            <div class="ub ub-ac fc_FF9D01">￥{{item.refundTicketGoPoundage}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">实退金额</div>
            <div class="ub ub-ac fc_FF9D01">￥{{item.refundTicketGoMoney}}</div>
          </div>
          <div class="ub ub-ver">
            <div class="ub wd_100 border_line ub-ver pad_t05">关联票号(航段)</div>
            <div class="ub ub-pj mar_t05" v-for="(obj, index) in item.orderTuiArr">
              <div class="ub">{{obj.detailTicketNumber}}</div>
              <div class="ub">
                <div class="ub">{{obj.beCity}}-</div>
                <div class="ub">{{obj.endCity}}</div>
                <div class="ub margin-l05">{{obj.orderGoFlightAirLine}}</div>
                <div class="ub">{{obj.detailFlightNo}}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!--退订增值服务信息-->
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w mar_t1" v-if="hasFy">
        <div class="ub wd_100 ub-pj pad_b05">
          <div class="ub">
            <div class="ub order_tui ub-img1"></div>
            <div class="ub ub-ac mar_l1">退订服务信息</div>
          </div>
          <div class="ub ub-img1 mar_l1" :class="{'arrow_down':orderFy,'arrow_up':!orderFy}" @click="orderFy = !orderFy"></div>
        </div>
        <div class="ub wd_100 border_line pad_t1 ub-ver" v-show="orderFy" v-for="(item, key) in orderFyObj">
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">申请单号</div>
            <div class="ub ub-ac">{{key}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">申请日期</div>
            <div class="ub ub-ac">{{item.goodsRefundTime}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">退订状态</div>
            <div class="ub ub-ac">{{item.goodsRefundStatus}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">实扣金额</div>
            <div class="ub ub-ac fc_FF9D01">￥{{item.goodsRefundPoundage}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">实退金额</div>
            <div class="ub ub-ac fc_FF9D01">￥{{item.goodsRefundMoney}}</div>
          </div>
          <div class="ub ub-ver">
            <div class="ub wd_100 border_line ub-ver pad_t05">关联票号(航段)</div>
            <div class="ub ub-pj mar_t05" v-for="(obj, index) in item.orderTuiArr">
              <div class="ub">{{obj.detailTicketNumber}}</div>
              <div class="ub">
                <div class="ub">{{obj.beCity}}-</div>
                <div class="ub">{{obj.endCity}}</div>
                <!-- <div class="ub margin-l05">{{obj.orderGoFlightAirLine}}</div>
                <div class="ub">{{obj.detailFlightNo}}</div> -->
              </div>
            </div>
          </div>
        </div>
      </div>
      <!--增值服务-->
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w mar_t1" v-show="showGoodsArr.length>0">
        <div class="ub wd_100 ub-pj pad_b05">
          <div class="ub">
            <div class="ub zengzhi ub-img1"></div>
            <div class="ub ub-ac mar_l1">增值服务</div>
          </div>
        </div>
        <div class="ub wd_100 border_line pad_t1 ub-ver">
          <div class="ub ub-ver mar_b1" v-for="(item, index) in showGoodsArr">
            <div class="ub wd_100 ub-pj pad_b05">
              <div class="ub">
                <div class="ub ub-ac">{{item.piName}}</div>
                <div class="ub ub-ac">
                  <div class="p_type">
                    {{item.piType}}
                  </div>
                </div>
              </div>
              <div class="ub">
                <!-- <div class="ub ub-ac">{{item.status}}</div> -->
                <div class="ub ub-img1 mar_l1" @click="item.ifshow = !item.ifshow" :class="{'arrow_down':item.ifshow,'arrow_up':!item.ifshow}"></div>
              </div>
            </div>
            <div class="ub wd_100 ub-pj pad_b05">
              <div class="ub">证件号</div>
              <div class="ub">{{item.piNumber}}</div>
            </div>
            <div class="ub wd_100 ub-pj pad_b05" v-show="orderType == 2">
              <div class="ub">电子票号</div>
              <div class="ub">{{item.ticketNumber}}</div>
            </div>
            <div class="ub p_box ub-ver fz08" v-show="item.ifshow">
              <div class="ub ub-ver" v-for="(obj, i) in item.goodsList">
                <div class="ub wd_100 ub-pj pad_b1">
                  <div class="ub ub-ac">{{obj.goodsChName}}</div>
                  <div class="ub ub-ac">￥{{obj.goodsPrice}}</div>
                </div>
              </div>
              <div class="ub wd_100 ub-pe">
                <div class="ub fc_FF9D01">小计：￥{{item.subTotal}}</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!--单独购买增值服务退订信息-->
      <div class="ub pad_05  bs_bb ub-ver wd_100 bg_w mar_t1" v-if="hasDdFy">
        <div class="ub wd_100 ub-pj pad_b05">
          <div class="ub">
            <div class="ub order_tui ub-img1"></div>
            <div class="ub ub-ac mar_l1">退订服务信息</div>
          </div>
          <div class="ub ub-img1 mar_l1" :class="{'arrow_down':orderDdFy,'arrow_up':!orderDdFy}" @click="orderDdFy = !orderDdFy"></div>
        </div>
        <div class="ub wd_100 border_line pad_t1 ub-ver" v-show="orderFy" v-for="(item, key) in orderDdFyObj">
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">申请单号</div>
            <div class="ub ub-ac">{{key}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">申请日期</div>
            <div class="ub ub-ac">{{item.goodsRefundTime}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">退订状态</div>
            <div class="ub ub-ac">{{item.goodsRefundStatus}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">实扣金额</div>
            <div class="ub ub-ac fc_FF9D01">￥{{item.goodsRefundPoundage}}</div>
          </div>
          <div class="ub ub-pj ub-ac pad_b05">
            <div class="ub ub-ac">实退金额</div>
            <div class="ub ub-ac fc_FF9D01">￥{{item.goodsRefundMoney}}</div>
          </div>
          <div class="ub ub-ver">
            <div class="ub wd_100 border_line ub-ver pad_t05">关联票号(航段)</div>
            <div class="ub ub-pj mar_t05" v-for="(obj, index) in item.orderTuiArr">
              <div class="ub">{{obj.detailTicketNumber}}</div>
              <div class="ub">
                <div class="ub">{{obj.beCity}}-</div>
                <div class="ub">{{obj.endCity}}</div>
                <!-- <div class="ub margin-l05">{{obj.orderGoFlightAirLine}}</div>
                <div class="ub">{{obj.detailFlightNo}}</div> -->
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="ub pad_05 bs_bb wd_100 bg_w mar_t1 ub-pj" v-show="orderType == 1 && orderDetail.orderPayHandle !=0">
        <div class="ub ub-ac" @click="yuchulipop">
          <div class="ub ub-img shouxufei"></div>
          <div class="ub ub-ac mar_l1">交易处理费</div>
          <div class="ub ub-img question mar_l1"></div>
        </div>
        <div class="ub fc_FF9D01">￥{{orderDetail.orderPayHandle}}</div>
      </div>
      <div class="ub pad_1 bs_bb wd_100 mar_t1 warming fz08">
        温馨提示：如果您的订单在其他渠道（如官网、呼叫中心）进行过改期等其他变更操作，请以实际变更结果为准。
      </div>
      <div class="ub pad_05 bs_bb wd_100 bg_w mar_t1 ub-pc mar_b1">
        <div class="ub ub-img phone"></div>
        <div class="ub ub-ac mar_l1">
          <a style="color:#843D99" href="tel:95373">拨打客服电话:95373</a>
        </div>
      </div>
      <div class="ub htimes" v-show="(orderDetail.orderStatus==='已预订' && payEndTime > sysTime) || orderDetail.orderStatus==='已出票' || orderDetail.orderStatus==='已支付'"></div>
    </div>
    <div class="footer" v-show="orderDetail.orderStatus==='已预订' && payEndTime > sysTime">
      <div class="ub wd_100">
        <div class="canncel ub ub-ac ub-pc wd_50" @click="canncelOrder">取消订单</div>
        <div @click="pay" class="goToPay ub ub-ac ub-pc wd_50">立刻支付</div>
      </div>
    </div>
    <div class="footer" v-show="orderDetail.orderStatus==='已出票' || orderDetail.orderStatus==='已支付'">
      <div class="ub wd_100">
        <!-- <div class="canncel ub ub-ac ub-pc wd_50"></div> -->
        <div @click="refund" class="goToPay ub ub-ac ub-pc wd_100">{{orderType == 2 ? '退订': '退票'}}</div>
      </div>
    </div>
    <div class="pop2 ub-f1 ub ub-ver ub-pe" v-show="isPop4" @click="yuchulipop">
      <div class="closeIcon ub-img closeIcon2 uhide"></div>
      <div class="pop3box">
        <div class="bg_w popdata" style="border-radius:0">
          <div class="f16">交易处理费:</div>
          <div class="pop4" v-html="pop4Data">

          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script type="text/ecmascript-6">
import { mapState } from 'vuex';
export default {
  // v-show="orderDetail.orderStatus==='已预订' && payEndTime > sysTime"
  created: function () {
    this.$store.commit('changeHeader', { // 提交首页header
      left: '返回',
      right: '',
      middle: '订单详情',
      ifshow: true,
      leftAction: '-1',
      leftIcon: 'leftIcon',
      rightAction: '',
      rightIcon: ''
    });
    this.getData();
    this.getzhifufeiinfo()
  },
  data: function () {
    return {
      orderType: '',
      showOrder: true,
      showObjArr: [],
      showGoodsArr: [],
      orderDetail: '',
      orderTimes: { four: '' },
      payEndTime: '',
      sysTime: '',
      relationOrderId: '', // 关联机票
      isPop4: false, // 交易处理费
      pop4Data: '',
      orderTui: true, // 是否展示机票退订信息
      orderFy: true, // 是否展示辅营退订信息
      orderDdFy: true,
      orderTuiObj: '', // 退票展示信息
      orderFyObj: '', // 流程内辅营展示信息
      orderDdFyObj: '', // 单独购买辅营的退订信息
      hasTui: false,
      hasFy: false,
      hasDdFy: false,
      passengerMask: false
    }
  },
  components: {
  },
  computed: mapState(['loginData', 'allOrders', 'orderPayment', 'ishome']),
  methods: {
    buyFy: function (ticketNo, piName) {
      // console.log(ticketNo + '-' + piName);
      this.passengerMask = false;
      let data = {
        pzlxname: '票号',
        passengerName: piName,
        ticketNO: ticketNo
      }
      this.$store.commit('setXingli', data)
      this.$router.push('/Reservation')
    },
    ydClick: function () {
      console.log(123);
      if (this.showObjArr.length === 1) {
        let obj = this.showObjArr[0];
        let ticketNo = obj.ticketNo;
        let piName = obj.piName;
        this.buyFy(ticketNo, piName);
      } else {
        this.passengerMask = true;
      }
      // this.passengerMask = true;
    },
    yuchulipop: function () {
      this.isPop4 = !this.isPop4;
    },
    getzhifufeiinfo: function () {
      let self = this;
      let content = {
        'isBill': 'false',
        'columnId': '150',
        'pageNo': '1',
        'pageSize': '10'
      }
      let data = this.$utils.getUserContent(content);
      this.$store.commit('showLoading');
      this.$http.post(this.$RS.helpCenterDetail, data).then(
        function (res) {
          // 响应成功回调
          res = res.body;
          if (res.code === 1000) {
            console.log(res)
            self.pop4Data = res.content.list[0].content;
          } else {
            this.$store.commit('closePop');
            this.$store.dispatch('showTx', { text: res.message });
          }
        },
        function (err) {
          this.$store.commit('closePop');
          // 响应错误回调
          this.$store.dispatch('showTx', { text: err.message || '网络错误，请重试' });
        }
      );
    },
    canncelOrder: function () {
      let self = this;
      this.$store.commit('setConfirm', { ifShow: true, text: '是否要取消当前订单？' });
      this.$store.commit('setConfirmCallBak', function () {
        console.log('123');
        self.doCanncelOrder();
      });
    },
    doCanncelOrder: function () {
      let showOrder = this.allOrders.showOrder;
      let orderType = showOrder.orderType + '';
      let orderId = showOrder.orderId + '';
      let userInfo = this.loginData.userInfo;
      let userId = userInfo.userId + '';
      let loginToken = userInfo.token.loginToken;
      let content = {
        OrderType: orderType,
        UserId: userId,
        OrderId: orderId
      }
      let data = this.$utils.getUserContent(content);
      data.headers.userId = userId;
      data.headers.loginToken = loginToken;
      let me = this;
      this.$utils.ajax(data, 'cancelOrder', me, function (data) {
        console.log(data);
        me.$store.dispatch('showTx', { text: '订单已取消' });
        me.getData();
      });
    },
    refund: function () {
      let orderType = Number(this.allOrders.showOrder.orderType);
      let self = this;
      if (orderType !== 2) {
        this.$store.commit('setConfirm', { ifShow: true, text: '确定退订机票？' });
        this.$store.commit('setConfirmCallBak', function () {
          // console.log('123');
          self.$router.push('/ApplyRefund');
        });
      } else {
        this.$store.commit('setConfirm', { ifShow: true, text: '确定退订辅营？' });
        this.$store.commit('setConfirmCallBak', function () {
          // console.log('123');
          self.$router.push('/ApplyViceCamp');
        });
      }
    },
    pay: function () {
      this.$router.push('/orderPayment')
    },
    resetData: function () {
      this.orderType = '';
      this.showOrder = true;
      this.showObjArr = [];
      this.showGoodsArr = [];
      this.orderDetail = '';
      this.orderTimes = '';
      this.payEndTime = '';
      this.sysTime = '';
      this.relationOrderId = '';
    },
    goTicket: function () {
      if (!this.relationOrderId) {
        return false;
      }
      // let self = this;
      this.$store.commit('showOrder', { orderId: this.relationOrderId, orderType: 1 });
      this.getData();
      // this.$router.replace('/empty_path', function () {
      //   // console.log(123);
      //   self.$router.replace('/orderDetail');
      // });
      // this.$router.replace('/orderDetail');
      // let timmer = setTimeout(function () {
      //   self.$router.replace('/orderDetail');
      //   clearTimeout(timmer);
      //   timmer = null;
      // }, 50);
    },
    showFooter: function () {
      if (this.sysTime > this.payEndTime) {
        return false;
      }
      let me = this;
      let timer = setInterval(function () {
        if (me.payEndTime > me.sysTime) {
          me.sysTime += 1000;
        } else {
          clearInterval(timer);
          timer = null;
        }
      }, 1000);
    },
    getData: function () {
      this.resetData(); // 重置页面
      let showOrder = this.allOrders.showOrder;
      let orderType = showOrder.orderType + '';
      this.orderType = orderType;
      let orderId = showOrder.orderId + '';
      let userInfo = this.loginData.userInfo;
      let userId = userInfo.userId + '';
      let loginToken = userInfo.token.loginToken;
      let content = {
        'OrderType': orderType,
        'OrderId': orderId
      };
      console.log('getData');
      // console.log(content)
      let data = this.$utils.getUserContent(content);
      data.headers.userId = userId;
      data.headers.loginToken = loginToken;
      // data.headers.token = loginToken;
      console.log(data);
      // return false;
      let self = this;
      this.$utils.ajax(data, 'ordersDetail', self, function (data) {
        console.log('success');
        console.log(data);
        self.$store.commit('setOrderPayment', data.content)
        let content = data.content;
        self.sysTime = content.systemTime; // 系统时间
        self.payEndTime = content.payEndTime; // 最迟支付时间
        // self.payEndTime = content.systemTime + 30000 // test
        self.showFooter();
        let orderDetail = content.order;
        self.orderDetail = orderDetail; // 订单总情况的
        let orderNo = orderDetail.orderNo;
        // let showOrder = self.allOrders.showOrder;
        let orderType = orderDetail.orderType + '';
        let orderId = orderDetail.orderId + '';
        self.$store.commit('showOrder', { orderId, orderType, orderNo });
        self.orderTimes = self.$utils.getWeek(orderDetail.orderGoBeginDate);
        let zengzhiDetail = content.list;
        if (self.orderType === '1') { // 机票
          let ticketDetail = content.list2;
          let orderTuiObj = {};
          // let orderTuiArr = [];
          let orderFyObj = {};
          // let orderFyArr = [];
          zengzhiDetail.forEach(function (item, index, arr) { // 增值服务
            let status = orderDetail.orderStatus; // 状态
            let piNumber = item.piNumber; // 证件号
            let piName = item.piName; // 姓名
            let piType = item.piType; // 证件类型
            let goodsList = item.goodsList;
            let subTotal = 0;
            goodsList.forEach(function (item2, index, arr) {
              subTotal += item2.goodsPrice
            })
            let showGoodsArr = {
              status,
              piName,
              piType,
              piNumber,
              goodsList,
              subTotal,
              ifshow: false
            }
            if (goodsList.length > 0) {
              self.showGoodsArr.push(showGoodsArr);
            }
          });
          ticketDetail.forEach(function (item, index, arr) {
            // let status = item.detailTicketStatus // 状态
            let status = orderDetail.orderStatus // 状态
            let piNumber = item.piNumber; // 证件号
            let piName = item.piName; // 姓名
            let piType = item.piType; // 证件类型
            let detailTicketTPrice = item.detailTicketTPrice; // 民航发展基金
            let detailTicketPrice = item.detailTicketPrice; // 机票
            let detailTicketFPrice = item.detailTicketFPrice || 0; // 燃油
            let ticketNo = item.detailTicketNumber // 机票号 ;
            let showObj = {
              piNumber,
              piName,
              piType,
              detailTicketTPrice,
              detailTicketPrice,
              detailTicketFPrice,
              status,
              ticketNo,
              ifshow: false
            }
            self.showObjArr.push(showObj);

            if (item.refundTicketGoNum) {
              self.hasTui = true;
              let orderGoFlightAirLine = content.order.orderGoFlightAirLine; // PN
              let detailFlightNo = item.detailFlightNo; // 航班号
              let detailTicketNumber = item.detailTicketNumber; // 票号
              let beCity = item.detailBeginCity.split('_')[0]; // 起飞城市
              let endCity = item.detailEndCity.split('_')[0]; // 到达城市
              let refundTicketGoNum = item.refundTicketGoNum; // 申请单号
              let refundTicketGoMoney = Number(item.refundTicketGoMoney); // 实退金额
              let refundTicketGoPoundage = Number(item.refundTicketGoPoundage); // 实扣金额
              let tuiObj = {
                orderGoFlightAirLine,
                detailFlightNo,
                detailTicketNumber,
                beCity,
                endCity
              }
              if (orderTuiObj[refundTicketGoNum]) {
                // orderTuiArr.push(tuiObj);
                // orderTuiObj[refundTicketGoNum].push(tuiObj);
                orderTuiObj[refundTicketGoNum].orderTuiArr.push(tuiObj);
                orderTuiObj[refundTicketGoNum].refundTicketGoMoney += refundTicketGoMoney;
                orderTuiObj[refundTicketGoNum].refundTicketGoPoundage += refundTicketGoPoundage;
              } else {
                // orderTuiArr.push(tuiObj);
                let refundTicketGoState = item.refundTicketGoState; // 退款状态
                let refundTicketGoTime = item.refundTicketGoTime; // 退款申请时间
                // let refundTicketGoMoney = item.refundTicketGoMoney; // 实退金额
                // let refundTicketGoPoundage = item.refundTicketGoPoundage; // 实扣金额
                orderTuiObj[refundTicketGoNum] = {};
                orderTuiObj[refundTicketGoNum].refundTicketGoState = refundTicketGoState;
                orderTuiObj[refundTicketGoNum].refundTicketGoTime = refundTicketGoTime;
                orderTuiObj[refundTicketGoNum].refundTicketGoMoney = refundTicketGoMoney;
                orderTuiObj[refundTicketGoNum].refundTicketGoPoundage = refundTicketGoPoundage;
                orderTuiObj[refundTicketGoNum].orderTuiArr = [];
                orderTuiObj[refundTicketGoNum].orderTuiArr.push(tuiObj);
              }
            } else {
              // self.hasTui = false;
            }
            item.goodsList.forEach(function (goodsItem) {
              if (goodsItem.goodsRefundNum) {
                self.hasFy = true;
                let orderGoFlightAirLine = content.order.orderGoFlightAirLine; // PN
                let detailFlightNo = goodsItem.detailFlightNo; // 航班号
                let detailTicketNumber = goodsItem.ticketNumber; // 票号
                let beCity = goodsItem.beginCity; // 起飞城市
                let endCity = goodsItem.endCity; // 到达城市
                let goodsRefundNum = goodsItem.goodsRefundNum; // 申请单号
                let goodsRefundMoney = Number(goodsItem.goodsRefundMoney); // 实退金额
                let goodsRefundPoundage = Number(goodsItem.goodsRefundPoundage); // 实扣金额
                let tuiObj = {
                  orderGoFlightAirLine,
                  detailFlightNo,
                  detailTicketNumber,
                  beCity,
                  endCity
                }
                if (orderFyObj[goodsRefundNum]) {
                  // orderFyObj.push(tuiObj);
                  // orderFyObj[refundTicketGoNum].push(tuiObj);
                  orderFyObj[goodsRefundNum].orderTuiArr.push(tuiObj);
                  orderFyObj[goodsRefundNum].goodsRefundMoney += goodsRefundMoney;
                  orderFyObj[goodsRefundNum].goodsRefundPoundage += goodsRefundPoundage;
                } else {
                  // orderTuiArr.push(tuiObj);
                  let goodsRefundStatus = goodsItem.goodsRefundStatus; // 退款状态
                  let goodsRefundTime = goodsItem.goodsRefundTime; // 退款申请时间
                  // let refundTicketGoMoney = goodsItem.refundTicketGoMoney; // 实退金额
                  // let goodsRefundPoundage = goodsItem.goodsRefundPoundage; // 实扣金额
                  orderFyObj[goodsRefundNum] = {};
                  orderFyObj[goodsRefundNum].goodsRefundStatus = goodsRefundStatus;
                  orderFyObj[goodsRefundNum].goodsRefundTime = goodsRefundTime;
                  orderFyObj[goodsRefundNum].goodsRefundMoney = goodsRefundMoney;
                  orderFyObj[goodsRefundNum].goodsRefundPoundage = goodsRefundPoundage;
                  orderFyObj[goodsRefundNum].orderTuiArr = [];
                  orderFyObj[goodsRefundNum].orderTuiArr.push(tuiObj);
                }
              } else {
                // self.hasFy = false;
              }
            });
          });
          self.orderFyObj = orderFyObj;
          self.orderTuiObj = orderTuiObj;
        } else { // 增值服务
          let order = content.order
          // let zzUser = content.userinfo;
          // console.log(zzUser)
          self.relationOrderId = order.relationOrderId;
          let piNumber = order.piNumber;
          let piName = order.piName;
          let piType = order.piType;
          let ticketNumber = order.ticketNumber;
          let status = orderDetail.orderStatus;
          let goodsList = [];
          let subTotal = 0;
          zengzhiDetail.forEach(function (item, index, arr) {
            let goodsChName = item.goodsChName
            let goodsPrice = item.goodsPrice
            subTotal += goodsPrice;
            let infoArr = {
              goodsChName,
              goodsPrice
            };
            goodsList.push(infoArr);
          })
          let showGoodsArr = {
            status,
            piName,
            piType,
            piNumber,
            goodsList,
            ticketNumber,
            subTotal,
            ifshow: false
          }
          if (goodsList.length > 0) {
            self.showGoodsArr.push(showGoodsArr);
          }
          let orderDdFyObj = {};
          zengzhiDetail.forEach(function (goodsItem) { // 退订增值服务详情
            if (goodsItem.goodsRefundNum) {
              console.log('in');
              self.hasDdFy = true;
              let orderGoFlightAirLine = content.order.orderGoFlightAirLine; // PN
              let detailFlightNo = goodsItem.detailFlightNo; // 航班号
              let detailTicketNumber = goodsItem.ticketNumber; // 票号
              let beCity = goodsItem.beginCity; // 起飞城市
              let endCity = goodsItem.endCity; // 到达城市
              let goodsRefundNum = goodsItem.goodsRefundNum; // 申请单号
              let goodsRefundMoney = Number(goodsItem.goodsRefundMoney); // 实退金额
              let goodsRefundPoundage = Number(goodsItem.goodsRefundPoundage); // 实扣金额
              let tuiObj = {
                orderGoFlightAirLine,
                detailFlightNo,
                detailTicketNumber,
                beCity,
                endCity
              }
              if (orderDdFyObj[goodsRefundNum]) {
                // orderFyObj.push(tuiObj);
                // orderFyObj[refundTicketGoNum].push(tuiObj);
                orderDdFyObj[goodsRefundNum].orderTuiArr.push(tuiObj);
                orderDdFyObj[goodsRefundNum].goodsRefundMoney += goodsRefundMoney;
                orderDdFyObj[goodsRefundNum].goodsRefundPoundage += goodsRefundPoundage;
              } else {
                // orderTuiArr.push(tuiObj);
                let goodsRefundStatus = goodsItem.goodsRefundStatus; // 退款状态
                let goodsRefundTime = goodsItem.goodsRefundTime; // 退款申请时间
                // let refundTicketGoMoney = goodsItem.refundTicketGoMoney; // 实退金额
                // let goodsRefundPoundage = goodsItem.goodsRefundPoundage; // 实扣金额
                orderDdFyObj[goodsRefundNum] = {};
                orderDdFyObj[goodsRefundNum].goodsRefundStatus = goodsRefundStatus;
                orderDdFyObj[goodsRefundNum].goodsRefundTime = goodsRefundTime;
                orderDdFyObj[goodsRefundNum].goodsRefundMoney = goodsRefundMoney;
                orderDdFyObj[goodsRefundNum].goodsRefundPoundage = goodsRefundPoundage;
                orderDdFyObj[goodsRefundNum].orderTuiArr = [];
                orderDdFyObj[goodsRefundNum].orderTuiArr.push(tuiObj);
              }
            } else {
              // self.hasFy = false;
            }
          });
          self.orderDdFyObj = orderDdFyObj;
        }
      })
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '../../stylus/base.styl';
.ticket
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('detail_ticket@2x.png');
.zengzhi
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('detail_zengzhi@2x.png');
.plane
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('detail_plane@2x.png');
.phone
  width: f_times(2);
  height: f_times(2);
  background-image: url('detail_tel2x.png');
.detail_passenger
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('detail_passengers@2x.png');
.order_tui
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('order_tui.png');
.arrow_up
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('arrow_up@2x.png');
.arrow_right
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('arrow_right@2x.png');
.detail_need_shipin
  width: f_times(3);
  height: f_times(3);
  background-image: url('detail_need_shipin@2x.png');
.detail_need_pack
  width: f_times(3);
  height: f_times(3);
  background-image: url('detail_need_pack@2x.png');
.plane_dan
  width: f_times(1.5);
  background-image: url('plane_line_dan.png');
.arrow_down
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('arrow_down@2x.png');
.shouxufei
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('detail_shouxu@2x.png');
.question
  width: f_times(1.5);
  height: f_times(1.5);
  background-image: url('question.png');
.border_line
  border-top: 1px solid #eee;
.p_type
  background-color: #E0CFE6;
  color: #79388D;
  font-size: f_times(0.6);
  line-height: f_times(0.6);
  padding: f_times(0.25) f_times(0.4);
  margin-left: f_times(0.4);
  border-radius: f_times(1);
.fc_FF9D01
  color: #ff9d01;
.fc_purple
  color: #843D99;
.p_box
  border: 1px solid #ddd;
  background-color: #F8F8F8;
  padding: f_times(1);
  >div
    box-sizing: border-box;
.warming
  color: #854A95;
  background-color: #EEDAF5;
  line-height: f_times(1.2);
.footer
  position: fixed;
  bottom: 0;
  width: 100%;
  height: f_times(3);
  z-index: 10;
  >div
    height: 100%;
    background-color: #fff;
  .goToPay
    color: #fff;
    background-color: $bgCol;
.htimes
  height: f_times(3);
  width: 100%;
.pop2
  background-color: rgba(0, 0, 0, 0.3);
  position: fixed;
  top: 0;
  height: 100%;
  width: 100%;
  z-index: 9999;
.pop3box
  bottom: 0;
.popdata
  border-radius: f_times(0.5);
  padding: f_times(1);
  height: 70%;
  overflow-y: scroll;
  font-size: f_times(1.05);
  line-height: f_times(1.3);
  margin-top: f_times(2.5);
.passengerMask
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  >.passengerBox
    width: 80%;
    // background-color: #fff;
    position: absolute;
    left: 10%;
    height: 100%;
    >.showPassenger
      width: 100%;
      background-color: #fff;
      min-height: f_times(1);
      max-height: f_times(10);
      box-sizing: border-box;
      z-index: 1500;
.canncelX
  position: absolute;
  right: f_times(0.1);
  top: f_times(0.1);
  z-index: 3000;
  color: #444;
</style>